<aside>
<h2>Downloads</h2>
<div><span class="spinning"></span></div>
<table class="table-downloads">
  <thead>
    {% if en %}
      <th>Release Notes</th>
      <th>Download</th>
      <th>Date</th>
    {% else %}
      <th>Релизы и инфо</th>
      <th>Скачать</th>
      <th>Дата</th>
    {% endif %}
  </thead>
  <tbody>
  </tbody>
</table>
<script>
  $.getJSON("http://api.github.com/repos/{{ site.github.owner_name }}/{{ site.github.repository_name }}/releases").done(function(json) {
    for (var i = 0; i < json.length; i++) {
      var release = json[i];
      if (release.assets.length === 0) {
        continue;
      }
      for (var j = 0; j < release.assets.length; j++) {
        var asset = release.assets[j];
        var fileSize = Math.round(asset.size / 1024);
        $(".table-downloads tbody")
          .append($("<tr>")
            .append($("<td>")
              .append($("<a>")
                .attr("href", release.html_url)
                .text(release.name)
              )
              .append(release.prerelease ? " (pre)" : "")
            )
            .append($("<td>")
              .append(asset.name + " ")
              .append($("<a>")
                .attr("href", asset.browser_download_url)
                .text(fileSize.toLocaleString() + "KB")
              )
            )
            .append($("<td>")
              .text(asset.updated_at.substring(0, 10))
            )
          );
      }
    }
    $(".spinning").hide();
    $(".table.downloads").fadeIn();
  });
</script>
<noscript>
  <p><a href="{{ site.github.releases_url }}" title="Releases">Releases on GitHub</a></p>
</noscript>
</aside>
